#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    srand(time(0));
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    ui->label->setText("太好了，我们来嘴一个，mua！！！");
}


void Widget::on_pushButton_2_clicked()
{
    // int width = this->geometry().width();
    // int height = this->geometry().height();
    // int x = rand() % width;
    // int y = rand() % height;
    // ui->pushButton_2->move(x,y);
    // ui->pushButton_2->setGeometry(rect.x(),rect.y() - 100,rect.width(),rect.height());
    // rect.setY(rect.y()-10);
    // ui->pushButton_2->setGeometry(rect);
}


void Widget::on_pushButton_2_pressed()
{
    int width = this->geometry().width();
    int height = this->geometry().height();
    int x = rand() % width;
    int y = rand() % height;
    ui->pushButton_2->move(x,y);
}

